import request from "@/utils/ajax.js"
//添加点赞-----------------------------------
export const addAttitude_api = (target) => {
  return request({
    url: '/app/v1_0/article/likings',
    method: 'post',
    data: {
      target
    }
  })
};
//取消点赞------------------------------------
export const delAttitude_api = (target) => {
  return request({
    url: `/app/v1_0/article/likings/${target}`,
    method: 'delete',
  })
}
//获取评论或评论回复------------------------
export const getComments_api = (params) => {
  return request({
    url: '/app/v1_0/comments',
    method: 'get',
    params,
  })
}
//添加评论--------------------------
export const addComments_api = (data) => {
  return request({
    url: '/app/v1_0/comments',
    method: 'post',
    data
  })
}
//对评论或评论回复点赞------------------------------
export const addLike_api=(target)=> {
  return request({
    url:'/app/v1_0/comment/likings',
    method:'post',
    data:{
      target   //点赞的评论id
    }   
  })
}
//取消对评论回复点赞----------------------------------
export const delLike_api=(target)=> {
  return request({
    url:'/app/v1_0/comment/likings/'+target,
    method:'delete'
  })
}
//获取用户个人资料
export const getUserprofile_api=(target)=> {
  return request({
    url:'/app/v1_0/user/profile',
    method:'get',
    params: {
      target
    }
  })
}
//修改用户昵称
export const editUserprofile_api=(data)=> {
  return  request({
    url:'/app/v1_0/user/profile',
    method:'PATCH',
    data
  })
}